﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MusicStore.Models
{
    // GET: Order
    /// <summary>
    /// 订单
    /// </summary>
    public class Order
    {
        public int OrderId { get; set; }//自动属性
        [DisplayName("订单编号")]
        public DateTime OrderDate { get; set; }
        [DisplayName("订购日期")]
        public string Username { get; set; }
        [DisplayName("用户名")]
        public string FirstName { get; set; }
        [DisplayName("名")]
        [Required(ErrorMessage ="*必填")]
        [StringLength(20)]//长度约束
        public string LastName { get; set; }
        [DisplayName("姓")]
        [Required(ErrorMessage = "*必填")]
        public string Address { get; set; }
        [DisplayName("区")]
        [Required(ErrorMessage = "*必填")]
        public string City { get; set; }
        [DisplayName("市")]
        [Required(ErrorMessage = "*必填")]
        public string State { get; set; }
        [DisplayName("省")]
        [Required(ErrorMessage = "*必填")]
        public string PostalCode { get; set; }
        [DisplayName("邮政编码")]
        [Required(ErrorMessage = "*必填")]
        public string Country { get; set; }
        [DisplayName("国家")]
        [Required(ErrorMessage = "*必填")]
        public string Phone { get; set; }
        [DisplayName("手机号")]
        [Required(ErrorMessage = "*必填")]
        public string Email { get; set; }
        [DisplayName("电子邮件")]
        [Required(ErrorMessage = "*必填")]
        public decimal Total { get; set; }
        [DisplayName("总数")]
        
        public List<OrderDetail> OrderDetails { get; set; }
        public Order()//日期取当前值

        {

            this.OrderDate = DateTime.Now;

        }

    }
}